'use strict';

const BaseController = require('./base.js')
const {Op} = require("sequelize");
const serviceName = 'email'
class ApiLogController extends BaseController {
    constructor(ctx) {
        super(ctx, serviceName);
    }

    getListQuery(query) {
        let where = {};

        if (query.subject) {
            where.subject = {
                [Op.like]: `%${query.subject}%`
            }
        }

        if (query.from) {
            where.from = {
                [Op.like]: `%${query.from}%`
            }
        }

        if (query.to) {
            where.to = {
                [Op.like]: `%${query.to}%`
            }
        }
        return where
    }
}

module.exports = ApiLogController;
